# Copyright 2010-2025 Google LLC
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

load("@com_google_protobuf//bazel:cc_proto_library.bzl", "cc_proto_library")
load("@com_google_protobuf//bazel:proto_library.bzl", "proto_library")
load("@rules_python//python:proto.bzl", "py_proto_library")

package(default_visibility = ["//visibility:public"])

proto_library(
    name = "callback_proto",
    srcs = ["callback.proto"],
    deps = [
        ":sparse_containers_proto",
        "@com_google_protobuf//:duration_proto",
    ],
)

cc_proto_library(
    name = "callback_cc_proto",
    deps = [
        ":callback_proto",
    ],
)

py_proto_library(
    name = "callback_py_pb2",
    deps = [":callback_proto"],
)

proto_library(
    name = "model_proto",
    srcs = ["model.proto"],
    deps = [
        ":sparse_containers_proto",
    ],
)

cc_proto_library(
    name = "model_cc_proto",
    deps = [
        ":model_proto",
    ],
)

py_proto_library(
    name = "model_py_pb2",
    deps = [":model_proto"],
)

proto_library(
    name = "model_parameters_proto",
    srcs = ["model_parameters.proto"],
    deps = [
        ":solution_proto",
        ":sparse_containers_proto",
        "@com_google_protobuf//:duration_proto",
    ],
)

cc_proto_library(
    name = "model_parameters_cc_proto",
    deps = [
        ":model_parameters_proto",
    ],
)

py_proto_library(
    name = "model_parameters_py_pb2",
    deps = [":model_parameters_proto"],
)

proto_library(
    name = "model_update_proto",
    srcs = ["model_update.proto"],
    deps = [
        ":model_proto",
        ":sparse_containers_proto",
    ],
)

cc_proto_library(
    name = "model_update_cc_proto",
    deps = [
        ":model_update_proto",
    ],
)

py_proto_library(
    name = "model_update_py_pb2",
    deps = [":model_update_proto"],
)

proto_library(
    name = "parameters_proto",
    srcs = ["parameters.proto"],
    deps = [
        "//ortools/glop:parameters_proto",
        "//ortools/gscip:gscip_proto",
        "//ortools/math_opt/solvers:glpk_proto",
        "//ortools/math_opt/solvers:gurobi_proto",
        "//ortools/math_opt/solvers:highs_proto",
        "//ortools/math_opt/solvers:osqp_proto",
        "//ortools/pdlp:solvers_proto",
        "//ortools/sat:sat_parameters_proto",
        "@com_google_protobuf//:duration_proto",
    ],
)

cc_proto_library(
    name = "parameters_cc_proto",
    deps = [
        ":parameters_proto",
    ],
)

py_proto_library(
    name = "parameters_py_pb2",
    deps = [":parameters_proto"],
)

proto_library(
    name = "result_proto",
    srcs = ["result.proto"],
    deps = [
        ":solution_proto",
        "//ortools/gscip:gscip_proto",
        "//ortools/math_opt/solvers:osqp_proto",
        "//ortools/pdlp:solve_log_proto",
        "@com_google_protobuf//:duration_proto",
    ],
)

cc_proto_library(
    name = "result_cc_proto",
    deps = [
        ":result_proto",
    ],
)

py_proto_library(
    name = "result_py_pb2",
    deps = [":result_proto"],
)

proto_library(
    name = "solution_proto",
    srcs = ["solution.proto"],
    deps = [
        ":sparse_containers_proto",
    ],
)

cc_proto_library(
    name = "solution_cc_proto",
    deps = [
        ":solution_proto",
    ],
)

py_proto_library(
    name = "solution_py_pb2",
    deps = [":solution_proto"],
)

proto_library(
    name = "sparse_containers_proto",
    srcs = ["sparse_containers.proto"],
)

cc_proto_library(
    name = "sparse_containers_cc_proto",
    deps = [
        ":sparse_containers_proto",
    ],
)

py_proto_library(
    name = "sparse_containers_py_pb2",
    deps = [":sparse_containers_proto"],
)

proto_library(
    name = "infeasible_subsystem_proto",
    srcs = ["infeasible_subsystem.proto"],
    deps = [
        ":result_proto",
    ],
)

cc_proto_library(
    name = "infeasible_subsystem_cc_proto",
    deps = [
        ":infeasible_subsystem_proto",
    ],
)

py_proto_library(
    name = "infeasible_subsystem_py_pb2",
    deps = [":infeasible_subsystem_proto"],
)

proto_library(
    name = "rpc_proto",
    srcs = ["rpc.proto"],
    deps = [
        ":callback_proto",
        ":infeasible_subsystem_proto",
        ":model_parameters_proto",
        ":model_proto",
        ":model_update_proto",
        ":parameters_proto",
        ":result_proto",
    ],
)

py_proto_library(
    name = "rpc_py_pb2",
    deps = [":rpc_proto"],
)

cc_proto_library(
    name = "rpc_cc_proto",
    deps = [":rpc_proto"],
)
